% Matlab function to call SVM routines

% assumes mex files have been precompiled
% initialize vars and compile mex files
clear
mex_path = strcat(pwd,'/mex');
addpath(mex_path);

% load data
data = csvread('data/abaloneData.csv');
features = data(:,2:9);
labels = data(:,1);

% cast data to single precision
features = single(features);
labels = single(labels);
c = single(5);
eps = single(0.00005);
tol = single(0.002);
transposedLabels = labels';
transposedFeatures = features'; %reads in column major - we want row major

% train model using libsvm smo and linear kernel
%tic
%libsvmResult = libsvmtrain(labels, features, '-h 0 -t 0');
%toc

% train model using cuSVM

% train model using matSVM
tic
alpha = svm(transposedFeatures, transposedLabels, c, eps, tol); 
toc

% clean up
rmpath(mex_path);
